<template>
  <div class="header">
    <h1>我是header</h1>
    <p>count:{{ count }}</p>
    <button @click="increment">累加</button>
    <button @click="incrementN({ n: 3 })">累加3</button>
    <button @click="waitIncrement({ n: 5 })">等会加5</button>
  </div>
</template>

<script>
import { mapActions, mapMutations, mapState } from "vuex";
export default {
  name: "Header",
  computed: {
    ...mapState(["count"]),
  },
  methods: {
    ...mapMutations(["increment", "incrementN"]),
    ...mapActions(["waitIncrement"]),
  },
};
</script>

<style scoped>
.header {
  background-color: chartreuse;
}
</style>